home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 10562 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  886 b 

  1. Path: ix.netcom.com!netnews
  2. From: miker3@ix.netcom.com (Mike Rubenstein)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: void test(...)
  5. Date: Mon, 18 Mar 1996 19:17:04 GMT
  6. Organization: Netcom
  7. Message-ID: <314dae95.240874709@nntp.ix.netcom.com>
  8. References: <4if00v$hdk@news.NetVision.net.il>
  9. NNTP-Posting-Host: ix-dc12-16.ix.netcom.com
  10. X-NETCOM-Date: Mon Mar 18 11:16:40 AM PST 1996
  11. X-Newsreader: Forte Agent .99d/32.182
  12.  
  13. nir@netvision.net.il (Nir Sofer) wrote:
  14.  
  15. > I know that i can create in C a function with  variable number of arguments.
  16. > void test(...)
  17. > {
  18. > }
  19. > But i can i use these arguments ???
  20.  
  21. What you know is incorrect.  That is not legal in C.  In C there must
  22. be at least one explicit argument, e.g.,
  23.  
  24.     #include <stdarg.h>
  25.  
  26.     void test(int n, ...)
  27.     {
  28.       /* ... */
  29.     }
  30.  
  31. In this case you can access the remaining arguments with the macros in
  32. <stdarg.h>
  33.  
  34.  
  35. Michael M Rubenstein
  36.